package com.iskny.framework.session;

import javax.servlet.http.HttpSession;

import com.iskny.framework.config.Constants;
import com.iskny.framework.model.LoginResult;
import com.iskny.framework.model.UserBean;

public class UserSession extends AbstractSessionManager<UserBean>{

	public static final String dataKey = "user";
	private static final String attrName = Constants.me().getUserKey();//默认"_user";
	
	public UserSession(HttpSession session) {
		super(session);
	}

	@Override
	protected void setAttrName() {
		super.setAttrName(attrName);
	}

	/**
	 * 用户状态验证
	 * @return
	 */
	public LoginResult isValidate(){
		LoginResult ret;
		if(getAttr()==null){
			ret = LoginResult.userNotExist;
		}else{
			ret = LoginResult.success;
		}
			
		return ret;
	}
}
